package net.scrumtool.view;

import net.scrumtool.technics.Utils;

import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.FormAttachment;
import org.eclipse.swt.layout.FormData;
import org.eclipse.swt.layout.FormLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
import org.eclipse.wb.swt.SWTResourceManager;

public class Profile {

	protected Shell shell;
	private Text txtFirstnameProfile;
	private Text txtLastnameProfile;
	private Text txtEmailProfile;
	private Text txtCurrentPasswordProfile;
	private Text txtNewPasswordProfile;
	private Text txtConfirmPasswordProfile;
	private Button btnChangePasswordProfile;
	private Group groupChangePasswordProfile;
	private Button btnEditProfile;

	/**
	 * Open the window.
	 */
	public void open() {
		Display display = Display.getDefault();
		shell.open();
		shell.layout();
		while (!shell.isDisposed()) {
			if (!display.readAndDispatch()) {
				display.sleep();
			}
		}
	}

	/**
	 * @wbp.parser.entryPoint
	 */
	public void init() {
		createContents();
	}

	public void close() {
		shell.dispose();
	}

	/**
	 * Create contents of the window.
	 */
	protected void createContents() {
		shell = new Shell(SWT.CLOSE);
		shell.setSize(381, 211);
		shell.setBackground(Utils.COLOR_BAR_1);
		shell.setText("SCRUMTOOL - Developed by TEAMSIO - version beta");
		shell.setLayout(new FormLayout());
		shell.setImage(Utils.getImage(Utils.IMG_ICON));

		Label lblFirstnameProfile = new Label(shell, SWT.NONE);
		lblFirstnameProfile.setForeground(SWTResourceManager.getColor(SWT.COLOR_WHITE));
		lblFirstnameProfile.setFont(SWTResourceManager.getFont("Arial", 11, SWT.NORMAL));
		FormData fd_lblFirstnameProfile = new FormData();
		lblFirstnameProfile.setBackground(Utils.COLOR_BAR_1);
		fd_lblFirstnameProfile.top = new FormAttachment(0, 42);
		fd_lblFirstnameProfile.left = new FormAttachment(0, 10);
		lblFirstnameProfile.setLayoutData(fd_lblFirstnameProfile);
		lblFirstnameProfile.setText("Firstname :");

		Label lblLastnameProfile = new Label(shell, SWT.NONE);
		lblLastnameProfile.setForeground(SWTResourceManager.getColor(SWT.COLOR_WHITE));
		lblLastnameProfile.setFont(SWTResourceManager.getFont("Arial", 11, SWT.NORMAL));
		FormData fd_lblLastnameProfile = new FormData();
		lblLastnameProfile.setBackground(Utils.COLOR_BAR_1);
		fd_lblLastnameProfile.top = new FormAttachment(lblFirstnameProfile, 19);
		fd_lblLastnameProfile.left = new FormAttachment(lblFirstnameProfile, 0, SWT.LEFT);
		lblLastnameProfile.setLayoutData(fd_lblLastnameProfile);
		lblLastnameProfile.setText("Lastname :");

		Label lblEmailProfile = new Label(shell, SWT.NONE);
		lblEmailProfile.setForeground(SWTResourceManager.getColor(SWT.COLOR_WHITE));
		lblEmailProfile.setFont(SWTResourceManager.getFont("Arial", 11, SWT.NORMAL));
		FormData fd_lblEmailProfile = new FormData();
		lblEmailProfile.setBackground(Utils.COLOR_BAR_1);
		fd_lblEmailProfile.top = new FormAttachment(lblLastnameProfile, 19);
		fd_lblEmailProfile.left = new FormAttachment(lblFirstnameProfile, 0, SWT.LEFT);
		lblEmailProfile.setLayoutData(fd_lblEmailProfile);
		lblEmailProfile.setText("Email :");

		btnChangePasswordProfile = new Button(shell, SWT.CHECK);
		btnChangePasswordProfile.setForeground(SWTResourceManager.getColor(SWT.COLOR_WHITE));
		btnChangePasswordProfile.setFont(SWTResourceManager.getFont("Arial", 11, SWT.NORMAL));
		FormData fd_btnChangePasswordProfile = new FormData();
		btnChangePasswordProfile.setBackground(Utils.COLOR_BAR_1);
		fd_btnChangePasswordProfile.top = new FormAttachment(lblEmailProfile, 21);
		fd_btnChangePasswordProfile.left = new FormAttachment(lblFirstnameProfile, 0, SWT.LEFT);
		btnChangePasswordProfile.setLayoutData(fd_btnChangePasswordProfile);
		btnChangePasswordProfile.setText("Change password");

		groupChangePasswordProfile = new Group(shell, SWT.NONE);
		FormData fd_groupChangePasswordProfile = new FormData();
		groupChangePasswordProfile.setVisible(false);
		fd_groupChangePasswordProfile.bottom = new FormAttachment(btnChangePasswordProfile, 115, SWT.BOTTOM);
		fd_groupChangePasswordProfile.top = new FormAttachment(btnChangePasswordProfile, 6);
		fd_groupChangePasswordProfile.left = new FormAttachment(0, 10);
		groupChangePasswordProfile.setBackground(Utils.COLOR_BAR_1);
		fd_groupChangePasswordProfile.right = new FormAttachment(0, 365);
		groupChangePasswordProfile.setLayoutData(fd_groupChangePasswordProfile);

		Label lblCurrentPasswordProfile = new Label(groupChangePasswordProfile, SWT.NONE);
		lblCurrentPasswordProfile.setForeground(SWTResourceManager.getColor(SWT.COLOR_WHITE));
		lblCurrentPasswordProfile.setBackground(Utils.COLOR_BAR_1);
		lblCurrentPasswordProfile.setFont(SWTResourceManager.getFont("Arial", 11, SWT.NORMAL));
		lblCurrentPasswordProfile.setBounds(10, 24, 125, 21);
		lblCurrentPasswordProfile.setText("Current password :");

		Label lblConfirmPasswordProfile = new Label(groupChangePasswordProfile, SWT.NONE);
		lblConfirmPasswordProfile.setForeground(SWTResourceManager.getColor(SWT.COLOR_WHITE));
		lblConfirmPasswordProfile.setBackground(Utils.COLOR_BAR_1);
		lblConfirmPasswordProfile.setFont(SWTResourceManager.getFont("Arial", 11, SWT.NORMAL));
		lblConfirmPasswordProfile.setBounds(10, 78, 128, 21);
		lblConfirmPasswordProfile.setText("Confirm password :");

		Label lblNewPasswordProfile = new Label(groupChangePasswordProfile, SWT.NONE);
		lblNewPasswordProfile.setForeground(SWTResourceManager.getColor(SWT.COLOR_WHITE));
		lblNewPasswordProfile.setBackground(Utils.COLOR_BAR_1);
		lblNewPasswordProfile.setFont(SWTResourceManager.getFont("Arial", 11, SWT.NORMAL));
		lblNewPasswordProfile.setBounds(10, 51, 125, 21);
		lblNewPasswordProfile.setText("New password :");

		txtCurrentPasswordProfile = new Text(groupChangePasswordProfile, SWT.BORDER | SWT.PASSWORD);
		txtCurrentPasswordProfile.setFont(SWTResourceManager.getFont("Arial", 11, SWT.NORMAL));
		txtCurrentPasswordProfile.setBounds(144, 23, 204, 21);

		txtNewPasswordProfile = new Text(groupChangePasswordProfile, SWT.BORDER | SWT.PASSWORD);
		txtNewPasswordProfile.setFont(SWTResourceManager.getFont("Arial", 11, SWT.NORMAL));
		txtNewPasswordProfile.setBounds(144, 51, 204, 21);

		txtConfirmPasswordProfile = new Text(groupChangePasswordProfile, SWT.BORDER | SWT.PASSWORD);
		txtConfirmPasswordProfile.setFont(SWTResourceManager.getFont("Arial", 11, SWT.NORMAL));
		txtConfirmPasswordProfile.setBounds(144, 78, 204, 21);

		txtFirstnameProfile = new Text(shell, SWT.BORDER);
		txtFirstnameProfile.setFont(SWTResourceManager.getFont("Arial", 11, SWT.NORMAL));
		FormData fd_txtFirstnameProfile = new FormData();
		fd_txtFirstnameProfile.right = new FormAttachment(lblFirstnameProfile, 210, SWT.RIGHT);
		fd_txtFirstnameProfile.left = new FormAttachment(lblFirstnameProfile, 6);
		txtFirstnameProfile.setLayoutData(fd_txtFirstnameProfile);

		txtLastnameProfile = new Text(shell, SWT.BORDER);
		fd_txtFirstnameProfile.bottom = new FormAttachment(txtLastnameProfile, -15);
		txtLastnameProfile.setFont(SWTResourceManager.getFont("Arial", 11, SWT.NORMAL));
		FormData fd_txtLastnameProfile = new FormData();
		fd_txtLastnameProfile.top = new FormAttachment(0, 74);
		fd_txtLastnameProfile.right = new FormAttachment(100, -82);
		fd_txtLastnameProfile.left = new FormAttachment(lblLastnameProfile, 6);
		txtLastnameProfile.setLayoutData(fd_txtLastnameProfile);

		txtEmailProfile = new Text(shell, SWT.BORDER);
		txtEmailProfile.setFont(SWTResourceManager.getFont("Arial", 11, SWT.NORMAL));
		FormData fd_txtEmailProfile = new FormData();
		fd_txtEmailProfile.top = new FormAttachment(txtLastnameProfile, 15);
		fd_txtEmailProfile.right = new FormAttachment(lblEmailProfile, 237, SWT.RIGHT);
		fd_txtEmailProfile.left = new FormAttachment(lblEmailProfile, 34);
		txtEmailProfile.setLayoutData(fd_txtEmailProfile);

		btnEditProfile = new Button(shell, SWT.NONE);
		btnEditProfile.setImage(Utils.getImage(Utils.IMG_SAVE));
		FormData fd_btnEditProfile = new FormData();
		fd_btnEditProfile.left = new FormAttachment(100, -84);
		fd_btnEditProfile.bottom = new FormAttachment(100, -10);
		fd_btnEditProfile.right = new FormAttachment(100, -10);
		btnEditProfile.setLayoutData(fd_btnEditProfile);
		btnEditProfile.setText("Save");

	}

	public Text getTxtCurrentPasswordProfile() {
		return txtCurrentPasswordProfile;
	}

	public Text getTxtNewPasswordProfile() {
		return txtNewPasswordProfile;
	}

	public Text getTxtConfirmPasswordProfile() {
		return txtConfirmPasswordProfile;
	}

	public Button getBtnEditProfile() {
		return btnEditProfile;
	}

	public Text getTxtFirstnameProfile() {
		return txtFirstnameProfile;
	}

	public Text getTxtLastnameProfile() {
		return txtLastnameProfile;
	}

	public Text getTxtEmailProfile() {
		return txtEmailProfile;
	}

	public Shell getShell() {
		return shell;
	}

	public Group getGroupChangePasswordProfile() {
		return groupChangePasswordProfile;
	}

	public Button getBtnChangePasswordProfile() {
		return btnChangePasswordProfile;
	}
}
